package cn.tedu.sp04.feign;

import cn.tedu.entity.User;
import cn.tedu.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Xiechong
 * @version 1.0
 * @ClassName: UserClist
 * @Description: TODO
 * @date 2021/12/16 14:28
 */
@FeignClient(name = "USER-SERVICE")//通过名称发现服务器的地址
public interface UserClient {
    @GetMapping("/{userId}")
    JsonResult<User> getUser(@PathVariable Integer userId);

    @GetMapping("/{userId}/score") //?score=1000
    JsonResult<?> addScore(@PathVariable Integer userId,
                           @RequestParam("score") Integer score);

}
